﻿Imports ReglasNegocio
Imports System.Collections.Generic
Imports System.Data

Partial Public Class Bandeja_Compras_Reporte_Excel
    Inherits System.Web.UI.Page

    Protected strFechaActual As String
    Protected strHoraActual As String
    Protected ParamLocal, ParamGrupo, ParamFecha As String
    Protected ParamNomLocal, ParamNomGrupo As String
    Protected dsConsulta As New DataSet

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        'Put user code to initialize the page here
        Response.Expires = 0
        Response.ContentEncoding = System.Text.Encoding.GetEncoding("ISO-8859-1")
        Response.ContentType = "application/xls"
        Response.AppendHeader("Content-disposition", "attachment; filename=Reporte_ComprasxDia.xls")
        SRT_RecuperacionFechas()
        CargaCompras(PreviousPage.CodLocalExcel, PreviousPage.FechaExcel, PreviousPage.GrupoExcel)
    End Sub
    Private Sub SRT_RecuperacionFechas()
        strFechaActual = Format(DateTime.Now.Date, "dd/MM/yyyy")
        Dim minuto As String
        If DateTime.Now.Minute < 10 Then
            minuto = "0" & DateTime.Now.Minute
        Else
            minuto = DateTime.Now.Minute
        End If
        strHoraActual = DateTime.Now.Hour & ":" & minuto
    End Sub


    Private Sub CargaCompras(ByVal pstrLocal As String, ByVal pstrFecha As String, ByVal pstrGrupo As String)
        ParamLocal = pstrLocal
        ParamGrupo = pstrGrupo
        ParamFecha = pstrFecha
        Dim Catalogo As CatalogoCajero = New CatalogoCajero()
        dsConsulta = Catalogo.ReporteCompras(pstrLocal, pstrFecha, pstrGrupo)
        ParamNomLocal = PreviousPage.NomLocalExcel
        ParamNomGrupo = PreviousPage.NomGrupoExcel
    End Sub

End Class


